package com.wanxi.controller;

import com.wanxi.VO.LeaveVO;
import com.wanxi.dto.ResultDTO;
import com.wanxi.service.LeaveService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Created by IntelliJ IDEA.
 * 留言
 * @Author : 林子淳
 * @create 2023/3/10 17:17
 */
@RestController
public class LeaveController {
    @Autowired
    private LeaveService leaveService;

    @PostMapping("/back/leave/delete")
    @CrossOrigin
    protected ResultDTO delete(LeaveVO leaveVO,HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        ResultDTO resultDTO = leaveService.delete(leaveVO);
        return resultDTO;
    }
    @GetMapping("/back/leave/findAll")
    @CrossOrigin
    protected ResultDTO findAll(LeaveVO leaveVO,HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        ResultDTO resultDTO = leaveService.findAll(leaveVO);
        return resultDTO;
    }
    }
